<template>
  <div class="header-container">
    <div class="l-container">
      <div class="l-content">
        <el-button icon="el-icon-menu" size="medium" style="margin-left: 20px" @click="handleMenu"></el-button>

        <el-breadcrumb separator="/" style="padding-left: 10px">
          <el-breadcrumb-item v-for="item in tags" :key="item.path" >
            {{ item.menuName }}
          </el-breadcrumb-item>

        </el-breadcrumb>
      </div>



    </div>

    <div class="r-container">
      <el-dropdown @command="handleCommand">
      <span>
        <img class="user-image" src="@/assets/1.jpg">
      </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="a">个人信息</el-dropdown-item>
          <el-dropdown-item command="b">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>

</template>

<script>

import {mapState} from "vuex";

export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Header",
  data() {
    return {}
  },
  methods: {
    handleCommand: function (commond) {
      if(commond === 'a'){

      }
      if(commond === 'b'){
        sessionStorage.clear();
        this.$router.push("/")
      }
    },
    handleMenu: function () {
      // 对菜单做缩放操作
      this.$store.commit('collapseChange')
    },

  },
  computed: {
    ...mapState({
      tags: state => state.tab.tabList
    })
  }
}
</script>

<style lang="less">
.header-container {
  height: 60px;
  //background-color: #242f42;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .firstPage {
    color: #E9EEF3;
    font-size: 14px;
    margin-left: 10px;
  }

}

.r-container {
  padding-right: 20px;
  .user-image {
    width: 40px;
    height: 40px;
    max-width: 100%; /* 添加max-width */
    max-height: 100%; /* 添加max-height */
    border-radius: 50%;
  }

}



.l-content {
  display: flex;
  align-items: center;

  /deep/ .el-breadcrumb__item {
    .el-breadcrumb__inner {
      font-weight: normal;

      &.is-link {
        color: #666;
      }
    }

    &:last-child {
      .el-breadcrumb__inner {
        color: #fff;
      }
    }

  }
}


</style>
